<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="../lib/bootstrap-3.3.5-dist/css/bootstrap.min.css">
  <script src="../lib/bootstrap-3.3.5-dist/js/jquery-1.11.3.js"></script>
  <script src="../lib/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
  <link rel="stylesheet" href="../css/caidanlan.css">
  <link rel="stylesheet" href="../css/shouye.css">
  <link rel="stylesheet" href="../font/iconfont.css">
  <script src="../javaScript/data_management.js"></script>
  <script src="../javaScript/kadaoqi.js"></script>
  <script src="../javaScript/quanxianpanduan.js"></script>
</head>

<body>
  <div class="container-fulid">
    <div class="row shouhang">
      <span class="iconfont icon-ziliaoku"></span>
      <p>图书馆后台管理系统</p>
      <div id='yonghu'>
      </div>
    </div>
    <div class="row">
      <div class="col-md-2 caidan">
        <a href="../html/jueseguanli.html">
          <p> 角色管理</p>
        </a>
        <a href="../html/guanliyuanguanli.html">
          <p>管理员管理</p>
        </a>
        <a href="./quanxianguanli.html">
          <p>权限管理</p>
        </a>
        <a href="../html/ReaderUser.html">
          <p>读者用户</p>
        </a>
        <a href="../html/duzhejuese.html">
          <p>读者角色</p>
        </a>
        <a href="../html/yuedu.html">
          <p>借阅查询</p>
        </a>
        <a href="../html/jieyueguanli.html">
          <p>借阅管理</p>
        </a>
        <a href="../html/book-management.html">
          <p>书刊管理</p>
        </a>
        <a href="../html/guancangdizhi.html">
          <p>馆藏地址管理</p>
        </a>
        <a href="../html/guancangfenlei.html">
          <p>馆藏分类管理</p>
        </a>
        <a href="../html/cengjiaLabel.html">
          <p>层架标签配置</p>
        </a>
        <a href="../html/fenguanshezhi.html">
          <p>分馆配置</p>
        </a>
        <a href="../html/book_inventory.html">
          <p>图书盘点</p>
        </a>
        <a href="../html/dindanguanli.html">
          <p>订单管理</p>
        </a>
        <a href="../html/tushuguanshezi.html">
          <p>图书馆设置</p>
        </a>
      </div>
      <div class="col-md-10 youbian">
        <p class="pp">首页</p>
        <div class="row">
          <div class="col-md-6">
            <div class="di">
              <span>日期选择:</span>
              <input type="date">
            </div>
          </div>
          <div class="col-md-3"></div>
          <div class="col-md-3" id="cha">
            <button onclick="cha()">查询</button>
          </div>
        </div>

        <div class="row">
          <div class="col-md-3">
            <div class="row">
              <div class="col-md-11">
                <p>书籍总数</p>
                <p class="sz" id="sjzs"></p>
                <p>周同比+54.55%日同比-6.25%</p>
              </div>
            </div>

          </div>
          <div class="col-md-3">
            <div class="row">
              <div class="col-md-11">
                <p>逾期未还</p>
                <p class="sz" id="yqwh"></p>
                <p>周同比+54.55%日同比-6.25%</p>
              </div>
            </div>

          </div>
          <div class="col-md-3">
            <div class="row">
              <div class="col-md-11">
                <p>用户总数</p>
                <p class="sz" id="yhzs"></p>
                <p>周同比+54.55%日同比-6.25%</p>
              </div>
            </div>

          </div>
          <div class="col-md-3">
            <div class="row">
              <div class="col-md-11">
                <p>今日借阅数</p>
                <p class="sz" id="jrjy"></p>
                <p>周同比+54.55%日同比-6.25%</p>
              </div>
            </div>

          </div>


        </div>
        <div class="row" id="rrr">
          <div class="col-md-6"></div>
          <div class="col-md-6">
            <div class="row" id="sr">
              <div class="col-md-3">
                <div class="row">
                  <div class="col-md-4">
                    <span id="sp1"></span>
                  </div>
                  <div class="col-md-8">
                    <p>书籍总数</p>
                  </div>
                </div>
              </div>
              <div class="col-md-3">
                <div class="row">
                  <div class="col-md-4">
                    <span id="sp2"></span>
                  </div>
                  <div class="col-md-8">
                    <p>逾期未还</p>
                  </div>
                </div>
              </div>
              <div class="col-md-3">
                <div class="row">
                  <div class="col-md-4">
                    <span id="sp3"></span>
                  </div>
                  <div class="col-md-8">
                    <p>用户总数</p>
                  </div>
                </div>
              </div>
              <div class="col-md-3">
                <div class="row">
                  <div class="col-md-4">
                    <span id="sp4"></span>
                  </div>
                  <div class="col-md-8">
                    <p>今日借阅数</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="row" id="zhuzhuang">
          <div class="row" id="zuzuan">
            <div class="col-md-2 zuziz">
            </div>
            <div class="col-md-2 zuziz"></div>
            <div class="col-md-2 zuziz"></div>
            <div class="col-md-2 zuziz"></div>
            <div class="col-md-2 zuziz"></div>
            <div class="col-md-2 zuziz"></div>
          </div>
          <div class="row" id="xian">
            <ul>
              <li>
                <p>80
                  <span></span>
                </p>

              </li>
              <li>
                <p>70
                  <span></span>
                </p>
              </li>
              <li>
                <p>60
                  <span></span>
                </p>
              </li>

              <li>
                <p>50
                  <span></span>
                </p>
              </li>

              <li>
                <p>40
                  <span></span>
                </p>
              </li>
              <li>
                <p>30
                  <span></span>
                </p>
              </li>
              <li>
                <p>20
                  <span></span>
                </p>
              </li>
              <li>
                <p>10
                  <span></span>
                </p>
              </li>
              <li>
                <p>0 &nbsp;
                  <span></span>
                </p>
              </li>
            </ul>
          </div>
        </div>


      </div>
      <script>
        var i1 = 0
        var i2 = 0
        var i3 = 0
        var i4 = 0
        arr = [i1, i2, i3, i4]
        var a
        var b
        var c
        let riqi = new Date().getFullYear() + "-" + parseInt(new Date().getMonth() + 1) + "-" + new Date().getDate()
        $(".di>input").val(riqi)
        cha()
        function panjrriqi(i) {
          let x = parseInt(i.substring(0, 4))
          let y = parseInt(i.substring(5, 7))
          let z = parseInt($(".di>input").val().substring(8, 10))
          console.log(z <= new Date().getDate());
          if (x < new Date().getFullYear()) {
            return 1

          }
          else if (x == new Date().getFullYear()) {
            if (y < parseInt(new Date().getMonth() + 1)) {
              return 1


            } else if (y == parseInt(new Date().getMonth() + 1)) {
              if (z <= new Date().getDate()) {
                return 1
              }
            }
          }
        }
        function biriqi(i) {
          $.each(Newbook, (index, item) => {
            a = item.reserve_time.substring(0, 4)
            b = item.reserve_time.substring(5, 7)
            c = item.reserve_time.substring(8, 10)
            let d = i.substring(0, 4)
            let e = i.substring(5, 7)
            let f = i.substring(8, 10)
            if (parseInt(d) > parseInt(a)) {
              i1++
            } else if (parseInt(d) == parseInt(a)) {
              if (parseInt(e) > parseInt(b)) {
                i1++
              } else if (parseInt(e) == parseInt(b)) {
                if (parseInt(f) >= parseInt(c)) {
                  i1++
                }
              }
            }
          })
        }
        function biriqi1(i) {
          $.each(duzhezhen, (index, item) => {
            let a = item.banzenriqi.substring(0, 4)
            let b = item.banzenriqi.substring(5, 7)
            let c = item.banzenriqi.substring(8, 10)
            let d = i.substring(0, 4)
            let e = i.substring(5, 7)
            let f = i.substring(8, 10)
            if (parseInt(d) > parseInt(a)) {
              i2++
            } else if (parseInt(d) == parseInt(a)) {
              if (parseInt(e) > parseInt(b)) {
                i2++
              } else if (parseInt(e) == parseInt(b)) {
                if (parseInt(f) >= parseInt(c)) {
                  i2++
                }
              }
            }
          })
        }
        function biriqi2(i) {
          $.each(jieshuarr, (index, item) => {
            a = item.jieshushijian.substring(0, 4)
            b = item.jieshushijian.substring(5, 7)
            c = item.jieshushijian.substring(8, 10)
            let d = i.substring(0, 4)
            let e = i.substring(5, 7)
            let f = i.substring(8, 10)
            if (parseInt(d) == parseInt(a)) {
              if (parseInt(e) == parseInt(b)) {
                if (parseInt(f) == parseInt(c)) {
                  i3++
                }
              }
            }
          })
        }
        function biriqi3(i) {
          $.each(jieshuarr, (index, item) => {
            if (item.yuqiguihuan == 1) {
              let a = item.guihuashijian.substring(0, 4)
              let b = item.guihuashijian.substring(5, 7)
              let c = item.guihuashijian.substring(8, 10)
              let d = i.substring(0, 4)
              let e = i.substring(5, 7)
              let f = i.substring(8, 10)
              if (parseInt(d) > parseInt(a)) {
                i4++
              } else if (parseInt(d) == parseInt(a)) {
                if (parseInt(e) > parseInt(b)) {
                  i4++
                } else if (parseInt(e) == parseInt(b)) {
                  if (parseInt(f) >= parseInt(c)) {
                    i4++
                  }
                }
              }
            }
          })
        }
        function panxia(n, n0) {
          let z
          let x = parseInt($(".di>input").val().substring(0, 4))
          let y = parseInt($(".di>input").val().substring(5, 7))
          if (y - n > 0) {
            $("#zuzuan>div").eq(n0).html(x + "-" + (y - n))
            z = x + "-" + (y - n)
          } else if (y - n == 0) {
            $("#zuzuan>div").eq(n0).html((x - 1) + "-" + 12)
            z = (x - 1) + "-" + 12
          } else {
            $("#zuzuan>div").eq(n0).html((x - 1) + "-" + 11)
            z = (x - 1) + "-" + 11
          }
          z = z + "-" + parseInt($(".di>input").val().substring(8, 10))
          fenli(z)
          for (j = 0; j <= 3; j++) {
            $("#zuzuan>div").eq(n0).append(`<div data-gao='${arr[j]}' class='zuzi zuzi${j}'></div>`)
          }
        }
        function panshan(n, n0) {
          let z
          let x = parseInt($(".di>input").val().substring(0, 4))
          let y = parseInt($(".di>input").val().substring(5, 7))
          if (y + n <= 12) {
            $("#zuzuan>div").eq(n0).html(x + "-" + (y + n))
            z = x + "-" + (y + n)
          } else if (y + n == 13) {
            $("#zuzuan>div").eq(n0).html((x + +1) + "-" + 1)
            z = (x + +1) + "-" + 1
          } else if (y + n == 14) {
            $("#zuzuan>div").eq(n0).html((x + +1) + "-" + 2)
            z = (x + +1) + "-" + 2
          }
          else if (y + n == 15) {
            $("#zuzuan>div").eq(n0).html((x + +1) + "-" + 3)
            z = (x + +1) + "-" + 3
          }
          z = z + "-" + parseInt($(".di>input").val().substring(8, 10))
          fenli(z)
          for (j = 0; j <= 3; j++) {
            $("#zuzuan>div").eq(n0).append(`<div data-gao='${arr[j]}' class='zuzi zuzi${j}'></div>`)
          }
        }
        function xuanxia() {
          $("#zuzuan>div").html("")
          let x = parseInt($(".di>input").val().substring(0, 4))
          let y = parseInt($(".di>input").val().substring(5, 7))
          let z = parseInt($(".di>input").val().substring(8, 10))
          if (panjrriqi($(".di>input").val())) {
            $("#zuzuan>div").eq(2).html(x + "-" + y)
            for (i = 0; i <= 3; i++) {
              $("#zuzuan>div").eq(2).append(`<div data-gao='${$(".sz").eq(i).text()}' class='zuzi zuzi${i}'></div>`)
            }
          }
          panxia(2, 0)
          panxia(1, 1)
          panshan(1, 3)
          panshan(2, 4)
          panshan(3, 5)

          for (let i = 0; i < 6; i++) {

            let q = $("#zuzuan>div").eq(i).text() + "-" + parseInt($(".di>input").val().substring(8, 10))
            if (!panjrriqi(q)) {
              $("#zuzuan>div").eq(i).html("")
            }
          }
        }
        function cha() {
          fenli($(".di>input").val())
          xuanranyemian()
        }
        function fenli(i) {
          i1 = 0
          i2 = 0
          i3 = 0
          i4 = 0
          biriqi(i)
          biriqi1(i)
          biriqi2(i)
          jisuyhsj()
          yuqiweihuan()
          biriqi3(i)
          arr = [i1, i4, i2, i3,]
        }
        function xuanranyemian() {
          $("#sjzs").html("")
          $("#sjzs").html(i1)
          $("#yhzs").html("")
          $("#yhzs").html(i2)
          $("#jrjy").html("")
          $("#jrjy").html(i3)
          $("#yqwh").html("")
          $("#yqwh").html(i4)
          xuanxia()
          for (i = 0; i <= 23; i++) {
            $(`.zuziz>div`).eq(i).css({
              height: $(`.zuziz>div`).eq(i).attr("data-gao") * 20 + "px"
            })
          }
        }
        isLogin()
        yonghu()
      </script>
</body>

</html>